(async function getData() {
    // Vue.createApp({
    //     data() {
    //         return {
    //             addData: []
    //         }
    //     }
    // })
    //this.addData.splice(0,this.addData.length)
    //this.addData.length = 0
    await axios.get('http://127.0.0.1:9094/countryMap', {}).then((response) => {
        var res = response.data;
        console.log(res)
        var chinaMap = echarts.init(document.getElementById('myMap2'))
        var option = {
            tooltip:{
                formatter: function (arg) {
                    return arg.name+'：'+arg.value
                }
            },
            geo: {
                map: "china",
                roam: true,
                zoom: 1.25,
                itemStyle: {
                    areaColor: "#fff",
                    borderColor: "#666",
                    borderWidth: "0.3",
                    opacity: 1
                },
                label: {
                    show: true,
                    fontSize: 10
                },
                emphasis: {
                    itemStyle: {
                        areaColor: "red"
                    }
                },
                select:{
                    itemStyle: {
                        areaColor: "red"
                    }
                }
            },
            series: [{
                type: "map",
                geoIndex: 0,
                data: res
            }],
            visualMap: {
                type: 'piecewise',
                pieces: [
                    {min: 0, max: 0, label: '0', color: '#fff'},
                    {min: 10000, max: 15000, label: '10000-15000', color: '#0687EE'},
                    {min: 15001, max: 20000, label: '15001-20000', color: '#00ACFB'},
                    {min: 20001, max: 25000, label: '20001-25000', color: '#00CAE4'},
                    {min: 25001, max: 30000, label: '25001-30000', color: '#00E2B6'},
                    {min: 30001, max: 35000, label: '30001-35000', color: '#90F187'},
                    {min: 35001, max: 40000, label: '35001-40000', color: '#F9F871'},
                ],
                itemWidth: 10,
                itemHeight: 10,
                itemGap: 2,
                inverse: false,
                textStyle:{
                    color:'#fff'
                }

            }
        }
        chinaMap.setOption(option)
    })
})()
